package com.lancoo.answer.ui.answerSheet.vh;

import android.text.SpannableString;
import android.text.SpannableStringBuilder;
import android.text.Spanned;
import android.text.style.ForegroundColorSpan;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;

import com.lancoo.answer.R;
import com.lancoo.answer.model.entity.AnswerSheetBean;

/**
 * Created by pengmi on 2022/2/22 9:06
 * Description:普通考试场景VH
 */
public class GeneralTestHeadVH extends AnswerSheetBaseVH{



    public static GeneralTestHeadVH getGeneralTestHead(@NonNull ViewGroup parent){
        View inflate = LayoutInflater.from(parent.getContext()).inflate(R.layout.ev_item_test_answer_sheet_head, parent, false);
        return new GeneralTestHeadVH(inflate);
    }


    public GeneralTestHeadVH(@NonNull View itemView) {
        super(itemView);
    }


    public void initData(int position,final AnswerSheetBean answerSheetBean){
        TextView tv_TestName=itemView.findViewById(R.id.tv_test_name);
        TextView tv_message=itemView.findViewById(R.id.tv_message);
        String testName="大学英语课后练习卷1";
        String totalChild=""+50;
        String testLength=""+120;
        tv_TestName.setText(testName);
        SpannableStringBuilder ssb=new SpannableStringBuilder();
        SpannableString ss1=new SpannableString(totalChild);
        ss1.setSpan(new ForegroundColorSpan(0xff0099ff),0,ss1.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
        SpannableString ss2=new SpannableString(testLength);
        ss2.setSpan(new ForegroundColorSpan(0xff0099ff),0,ss2.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);

        ssb.append("本卷共 ");
        ssb.append(ss1);
        ssb.append(" 小题，总时长 ");
        ssb.append(ss2);
        ssb.append(" 分钟\n纪律:禁止查看资料，视线离开屏幕、交头接耳\n注意事项:疑似舞弊提示后，可继续作答，教师将会公正判别");
        tv_message.setText(ssb);
    }

}
